# Contributor: Curt Tilmes <Curt.Tilmes@nasa.gov>
# Maintainer: Curt Tilmes <Curt.Tilmes@nasa.gov>
pkgname=zef
pkgver=0.8.5
pkgrel=0
pkgdesc="Raku / Perl6 Module Management"
url="https://github.com/ugexe/zef"
arch="all !x86 !armhf !armv7 !s390x !mips !mips64" # limited by rakudo
options="!archcheck" # Precompiled arch dependent files included (quiet noarch warning)
license="Artistic-2.0"
depends="rakudo git wget curl tar unzip perl perl-utils"
makedepends="rakudo-dev"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/ugexe/zef/archive/v$pkgver.tar.gz"

check() {
	prove -e 'raku -Ilib'
}

package() {
	RAKUDO_RERESOLVE_DEPENDENCIES=0 /usr/share/perl6/bin/install-dist.p6 \
		--to="$pkgdir/usr/share/perl6/vendor" --for=vendor
	rm "$pkgdir"/usr/share/perl6/vendor/bin/zef-j \
		"$pkgdir"/usr/share/perl6/vendor/bin/zef-m
	mkdir -p "$pkgdir"/usr/bin
	ln -s /usr/share/perl6/vendor/bin/zef "$pkgdir"/usr/bin/zef
}

doc() {
	cd "$builddir"
	mkdir -p "$subpkgdir"/usr/share/doc/"$pkgname"
	for file in LICENSE META6.json README.pod; do
		cp $file "$subpkgdir"/usr/share/doc/"$pkgname"
	done
}

sha512sums="80d22c69a61440bd37cf59b0cabb7a6b8251cc8a3e4a88bd7dd2197efa02cb4edd5cadb8da5191c3cc46e32f3ab7fc5abdd9c6b536ff8d1e7b717484641b9f00  zef-0.8.5.tar.gz"
